package com.xbongbong.paas.service;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasCommentEntityExt;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.pojo.CommentPojo;
import com.xbongbong.paas.pojo.dto.*;
import com.xbongbong.paas.pojo.vo.CommentAddOnCommentVO;
import com.xbongbong.paas.pojo.vo.CommentDeleteVO;
import com.xbongbong.paas.pojo.vo.CommentListVO;
import com.xbongbong.paas.pojo.vo.CommentAddVO;
import com.xbongbong.paas.pojo.vo.ReplyListVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.UserVO;
import com.xbongbong.saas.enums.BusinessCommentEnum;

import java.util.List;
import java.util.Map;

/**
 * @author: wufeng
 * @date: 2018/8/29 10:01
 * @desrcption: 评论操作
 */
public interface PaasCommentService {

    /**
     * 获取评论列表
     * @param commentListDTO
     * @return
     * @throws XbbException
     */
    CommentListVO list(CommentListDTO commentListDTO) throws XbbException;

    /**
     * 评论
     * @param commentAddDTO
     * @return
     * @throws XbbException
     */
    CommentAddVO
    add(CommentAddDTO commentAddDTO) throws XbbException;

    /**
     * 计数
     * @param corpid 公司id
     * @param businessType 业务类型
     * @param appId
     * @param refId 关联id
     * @return 计数
     */
    Integer getCount(String corpid, Integer businessType, Long appId, Long refId);

    /**
     * 评论总数map
     * @param dataIdIn
     * @param corpid
     * @param code
     * @return
     */
    Map<Long,Integer> getCommnetCountMap(List<Long> dataIdIn, String corpid, Integer code);

    /**
     * 客户机会阶段获取评论
     * @param stageLogIdIn 阶段记录idIn
     * @param corpid 公司id
     * @param codeMap id与code的map
     * @param type 阶段类型
     * @return
     */
    Map<String,List<CommentPojo>> getStageComment(List<Long> stageLogIdIn, String corpid, Map<Long, String> codeMap,Integer type, BaseDTO baseDTO) throws XbbException;

    /**
     * 有我评论的需求
     * @param dataIdIn
     * @param corpid
     * @param code
     * @param userId
     * @return
     */
    List<Long> hasMyComment(List<Long> dataIdIn, String corpid, Integer code, String userId);

    /**
     * 评论消息推送
     *
     * @param businessType  业务类型
     * @param refId         业务数据id
     * @param corpid        公司id
     * @param atUserIds     @的人员
     * @param content
     * @param businessCommentEnum
     * @author GuoJun.HU
     * @since V1.0
     * @throws XbbException XbbException
     * @date 2019/4/18 14:10
     */
    void pushComment(UserVO loginUser, Integer businessType, Long refId, String corpid, List<String> atUserIds, String content, BusinessCommentEnum businessCommentEnum, Boolean isInform) throws XbbException;

    /**
     * 评论@消息推送
     *
     * @param refId                 业务数据id
     * @param corpid                公司id
     * @param atUserIds             @的人员
     * @param businessCommentEnum   业务类型
     * @param paasFormDataEntityExt 业务数据
     * @param content
     * @author GuoJun.HU
     * @since V1.0
     * @throws XbbException XbbException
     * @date 2019/4/18 14:10
     */
    void pushCommentAt(UserVO loginUser, Long refId, String corpid, List<String> atUserIds, BusinessCommentEnum businessCommentEnum, PaasFormDataEntityExt paasFormDataEntityExt, String content) throws XbbException;

    /**
     * Description: 获取评论详情
     * @param commentDetailDTO
     * @author 魏荣杰
     * @date 2019/5/10 20:06
     * @since v1.0
     */
    List<PaasCommentEntityExt> getCommentDetail(CommentDetailDTO commentDetailDTO) throws XbbException;

    /**
     * Description: 评论评论用
     *
     * @param commentAddOnCommentDTO@return com.xbongbong.paas.pojo.vo.CommentAddVO
     * @throws XbbException XbbException
     * @author 魏荣杰
     * @date 2019/5/12 11:08
     * @since v1.0
     */
    CommentAddOnCommentVO addOnComment(CommentAddOnCommentDTO commentAddOnCommentDTO) throws XbbException;

    /**
     *  审批评论@推送消息
     * @param loginUser
     * @param refId
     * @param atUserIds
     * @throws XbbException
     */
    void pushProcessComment(UserVO loginUser, Long refId, List<String> atUserIds) throws XbbException;

    /**
     *  删除评论
     * @param commentDeleteDTO
     * @throws XbbException
     */
    CommentDeleteVO delete(CommentDeleteDTO commentDeleteDTO) throws XbbException;

    /**
     * 评论删除消息推送
     *
     * @param businessType  业务类型
     * @param refId         业务数据id
     * @param corpid        公司id
     * @param content
     * @param businessCommentEnum
     * @throws XbbException XbbException
     * @date 2020/4/15 13:40
     */
    void pushCommentDelete(UserVO loginUser, Integer businessType,Integer subType, Long refId, String corpid, String content, BusinessCommentEnum businessCommentEnum) throws XbbException;

    /**
     * 工单动态编辑流程
     *
     * @param commentEditDTO
     * @throws XbbException XbbException
     * @date 2020/4/15 13:40
     */
    CommentAddVO edit(CommentEditDTO commentEditDTO)throws XbbException;

    /**
     * 工单动态编辑消息推送
     *
     * @param businessType  业务类型
     * @param refId         业务数据id
     * @param corpid        公司id
     * @param content
     * @param businessCommentEnum
     * @throws XbbException XbbException
     * @date 2020/4/15 13:40
     */
    void pushCommentEdit(UserVO loginUser, Integer businessType, Long refId, String corpid, List<String> atUserIds, String content, BusinessCommentEnum businessCommentEnum) throws XbbException;

    JSONObject getWorkOrderDynamic(FormDataGetDTO formDataGetDTO) throws XbbException;

    ReplyListVO replyList(ReplyListDTO replyListDTO) throws XbbException;
}
